package com.cts.controller;

import com.cts.entity.Category;
import com.cts.model.vo.Result;
import com.cts.service.CategoryService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @projectName: CBlog
 * @package: com.cts.controller
 * @className: CategoryController
 * @author: chentongsheng
 * @description: TODO
 * @date: 2023/4/9 19:46
 * @version: 1.0
 */
@RestController
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    CategoryService categoryService;

    @ApiOperation("获取分类列表")
    @RequestMapping("getCategory")
    public Result getCategory() {
        List<Category> list = categoryService.list();
        return Result.ok("请求成功", list);
    }
}
